# This is Jack's webapp.
# created by Jack.
# Using python flask.
# Don't copy it.
#                   2021/6/6


from flask import Flask,render_template,request
from spider import getBaiduMessage

#webapp部分
app=Flask(__name__)

#home
@app.route('/webapp/home',methods=['GET','POST'])
def webhome():
    return render_template('webhome.html')

#baidu
@app.route('/webapp/baidu',methods=['GET'])
def baidu():
    return render_template('baidu.html')

@app.route('/webapp/baidu/search',methods=['GET'])
def search():
    keyword=request.args.get('key')
    text=getBaiduMessage(keyword)
    return text

#programming
@app.route('/webapp/programming',methods=['GET','POST'])
def programming():
    return render_template('programming.html')

@app.route('/webapp/programming/engineer1',methods=['GET','POST'])
def engineer1():
    return render_template('engineer1.html')

@app.route('/webapp/programming/engineer2',methods=['GET','POST'])
def engineer2():
    return render_template('engineer2.html')

#reading
@app.route('/webapp/reading',methods=['GET','POST'])
def reading():
    return render_template('reading.html')

@app.route('/webapp/reading/hogwarts_train',methods=['GET','POST'])
def hogwarts_train():
    return render_template('hogwarts_train.html')

@app.route('/webapp/reading/alphago',methods=['GET','POST'])
def alphago():
    return render_template('alphago.html')

@app.route('/webapp/reading/crisis',methods=['GET','POST'])
def crisis():
    return render_template('crisis.html')

@app.route('/webapp/reading/potato',methods=['GET','POST'])
def potato():
    return render_template('potatochips.html')

@app.route('/webapp/reading/conch',methods=['GET','POST'])
def conch():
    return render_template('conchcountry.html')

#notices
@app.route('/webapp/248maths/notices',methods=['GET','POST'])
def notices():
    return render_template('notices.html')

@app.route('/webapp/248maths/notice1',methods=['GET','POST'])
def notice1():
    return render_template('notice1.html')

#math problems
@app.route('/webapp/248maths/mathproblems',methods=['GET','POST'])
def mathproblems():
    return render_template('mathproblems.html')

@app.route('/webapp/248maths/mathproblem1',methods=['GET','POST'])
def mathproblem1():
    return render_template('mathproblem1.html')

@app.route('/webapp/248maths/mathproblem2',methods=['GET','POST'])
def mathproblem2():
    return render_template('mathproblem2.html')

@app.route('/webapp/248maths/mathproblem3',methods=['GET','POST'])
def mathproblem3():
    return render_template('mathproblem3.html')

@app.route('/webapp/248maths/mathproblem4',methods=['GET','POST'])
def mathproblem4():
    return render_template('mathproblem4.html')

@app.route('/webapp/python/pythonhome',methods=['GET','POST'])
def pythonhome():
    return render_template('pythonhome.html',python=True)

@app.route('/webapp/python/pythonintro',methods=['GET','POST'])
def pythonintro():
    return render_template('pythonintro.html',python=True)

@app.route('/webapp/python/pythoninstall',methods=['GET','POST'])
def pythoninstall():
    return render_template('pythoninstall.html',python=True)

@app.route('/webapp/python/pythonide',methods=['GET','POST'])
def pythonide():
    return render_template('pythonide.html',python=True)

@app.route('/webapp/python/pythoninout',methods=['GET','POST'])
def pythoninout():
    return render_template('pythoninout.html',python=True)

@app.route('/webapp/python/pythonbasics',methods=['GET','POST'])
def pythonbasics():
    return render_template('pythonbasics.html',python=True)

@app.route('/webapp/python/pythondata',methods=['GET','POST'])
def pythondata():
    return render_template('pythondata.html',python=True)

@app.route('/webapp/python/pythonencoding',methods=['GET','POST'])
def pythonencoding():
    return render_template('pythonencoding.html',python=True)

@app.route('/webapp/python/pythonlisttuple',methods=['GET','POST'])
def pythonlisttuple():
    return render_template('pythonlisttuple.html',python=True)

@app.route('/webapp/whatif/sea1',methods=['GET','POST'])
def whatifsea1():
    return render_template('what_if_sea1.html')

if __name__=='__main__':
    app.run(port=9090)